haskell   61570

« earlier    

How do I modify a variable in Haskell? | Hacker News
I don't want people trying to follow the evolution to get the impression that iterating and writing to an array is really hard in Haskell,

module Main where

import Foreign.C.Types (CInt)
import Control.Monad (forM_)
import Numeric.LinearAlgebra (toLists) -- http://hackage.haskell.org/package/hmatrix-0.18.1.0/docs/Numeric-LinearAlgebra-Data.html
import Numeric.LinearAlgebra.Devel (runSTMatrix, newMatrix, writeMatrix) -- http://hackage.haskell.org/package/hmatrix-0.18.1.0/docs/Numeric-LinearAlgebra-Devel.html

main = do
putStrLn $ unlines $ fmap unwords $ fmap (fmap show) $ toLists aImmutable
where
aImmutable = runSTMatrix $ do
a <- newMatrix (0::CInt) 10 10
forM_ [0..9] $ \i -> writeMatrix a i i 1
return a
haskell 
yesterday by swlaschin
Opaleye tutorials : haskell
haskell database query-constructing library using arrows
haskell  database  db  library 
2 days ago by tswaterman
How do I modify a variable in Haskell?
Haskell programmers seem to get by without variable mutation, which is odd if you’re used to C, Javascript, or another imperative language. It seems like you...
haskell 
3 days ago by geetarista

« earlier    

related tags

2017-08-12  2017-08-14  2017-08-16  _publish  algorithm  algorithms  amazing  argument  array_programming  arrays  art  audio  aug17  benchmarking  bitemyapp  blog  blogs  book  categorytheory  cli  code-generation  coding  constructs  continuations  cool  course  cryptocurrency  cycle  data-structures  database  db  deeplearning  dependent-types  dependently_typed_programming  deriving  design-patterns  dev  development  ebook  eff  elm  emacs  endless  filesystem  floss  fp  framework  free-monad  free  fun  functional-dev  functional-programming  functional  functionalprogramming  game  generative  generic-programming  gif  gifs  git  github  gpu  graph-theory  graph  graphics  helloworld  infinite  inline_languages  interoperability  js  json  language  lazy  learning  libraries  library  links  lisp  livecoding  logging  loop  macros  math  modify  monad-transformers  monad  monads  music  nn  oo  oop  opensource  operational-monad  optimization  papers  parser  parsing  pattern  performance  pipes  podcasts  productivity  programming-language  programming  quickcheck  racket  read2of  recursion  reference  repository  research  rust  safe  scala  search  slack  snap  software-architecture  software-design  static  stream  streaming-video  streaming  system  tensorflow  terminal  time  timeseries  toolkit  tools  traits  tutorial  twilio  types  vim  visualization  web 

Copy this bookmark:



description:


tags: