This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # dollar exchange rate | |
| url="http://download.finance.yahoo.com/d/quotes.csv?s=USDGBP=X&f=nl1d1t1" | |
| curl -s -L $url > usd.csv & | |
| # download regular tickers | |
| PRE="http://download.finance.yahoo.com/d/quotes.csv?s=" | |
| POST="&f=sl1c1p2&e=.csv" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| program hard | |
| double precision, allocatable :: a(:) | |
| a = [10 , 12, 13] ! no need to count size beforehand | |
| print *, a | |
| end program hard |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ! compile using the command: | |
| ! gfortran `pkg-config --cflags --libs plplot-f95` -o myplot myplot.f90 | |
| program myplot | |
| use plplot | |
| implicit none | |
| integer, parameter :: dp=kind(0.0d0) | |
| real(kind=plflt), dimension(3):: x, y | |
| x = [1,2,3] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pyDatalog import pyDatalog as pdl | |
| # set up some basic terms | |
| pdl.create_terms('F,G,Q,what,eat') | |
| # F G | |
| +what('pork', 'meat') | |
| +what('lamb', 'meat') | |
| +what('peas', 'veg') | |
| +what('beans', 'veg') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| loopCollect state0 xs func = fst $ runState (forM xs func) state0 | |
| -- result is ["hello", " ", "world"] | |
| eg = loopCollect "hello world" [5, 1, 5] | |
| (\i -> do | |
| str <- get | |
| let (h, t) = splitAt i str | |
| put t | |
| return h) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ExampleVersion where | |
| {- | |
| links: | |
| http://stackoverflow.com/questions/9857710/haskell-correct-practice-to-specify-%5Cversion-in-source | |
| Be sure to put Paths_packagename in your Other-Modules section of the cabal file. | |
| -} | |
| import Paths_mypackage (version) -- replace 'mypackage' with you nnn.cabal 'name' tag |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Control.Monad | |
| import Data.List | |
| import Language.Haskell.Interpreter | |
| main :: IO () | |
| main = do r <- runInterpreter testHint | |
| case r of | |
| Left err -> printInterpreterError err | |
| Right () -> putStrLn "that's all folks" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Desktop entry for dillo. | |
| # System wide install as /usr/share/applications, or /usr/local/share/applications | |
| # Private install as $HOME/.local/share/applications | |
| # See http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.0.html | |
| # See http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html | |
| [Desktop Entry] | |
| Version=3.0.5 | |
| Type=Application | |
| Name=Dillo web browser | |
| GenericName=Web Browser |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/home/mcarter/.local/bin/octave-cli -qf -W | |
| # -*- octave -*- | |
| 1; | |
| h5name = "/home/mcarter/temp.h5" | |
| printf("Hello world\n"); | |
| pkg load hdf5oct | |
| data = h5read(h5name, "/D20151113/rs6mb"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Suppose I want to use an argument twice, as for example in the expression: | |
| (\x -> (pred1 x) and (pred2 x)) | |
| Is there a shorter way of doing this? | |
| liftA2 (&&) pred1 pred2 | |
| You can be cute and use the applicative instance on functions: | |
| (&&) <$> pred1 <*> pred2 |